<?php

class acategory extends CActiveRecord
{
	public static function model($className = __CLASS__ )
	{
		return parent::model($className);
	}
	
	public function relations()
	{
		return array(
			"sub_category" => array(self::HAS_MANY, 'acategory', 'parent_id'),
			"articles" => array(self::HAS_MANY, 'article', 'acategory_id'),
		);
	}
	
	public function scopes()
	{
		return array(
			"parent" => array("condition"=> "parent_id = 0", "order"=>"`order`")
		);
	}
}
